<template>
	<view>
		<view class="item" v-for="(indexItem,index) in data" :key="index">
			<view class="item_box">
				<view @tap="tap_item(indexItem)">
					<view class="item-title">{{indexItem.model_name}}</view>
					<view class="view-box-22 marginTop20">
						<view class="item-view-box-22" v-if="indexItem.appearance_name">
							{{indexItem.appearance_name}}/{{indexItem.interior_name}}
						</view>
						<view class="item-view-box-22" v-if="indexItem.province_name">{{indexItem.province_name}}</view>
					</view>
					<view></view>
					<view class="item-content-box">
						<view class="item-content">{{indexItem.content==null?'':indexItem.content}}</view>
						<view class="item-content" v-if="indexItem.mileage"> {{indexItem.mileage}}</view>
					</view>
					<view class="item-number-time-box">
						<view class="item-content-box">
							<view class="item-texr-price">{{indexItem.price}}</view>
							<view class="item-text-wan">万</view>
							<view class="item-text-rulePrice" v-if="indexItem.guide_price">指导价：{{indexItem.guide_price}}</view>
						</view>
						<view class="item-time">{{indexItem.create_time}}</view>
					</view>
					<view class="line-2"></view>
				</view>
				<view class="item-btn-box" v-if="selecteItem==1">
					<view class="item-btn"></view>
					<view class="item-btn-del" @tap="tap_item_del(indexItem,index)">删除</view>
					<view class="item-btn-up" @tap="tap_item_Up(indexItem,index)">上架</view>
				</view>
				<view class="item-btn-box" v-if="selecteItem==0">
					<view class="item-btn"></view>
					<view class="item-btn-del" @tap="tap_item_down(indexItem,index)">下架</view>
					<view class="item-btn-up" @tap="tap_item_edit(indexItem,index)">编辑</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "uniListCarSource",
		props: {
			/**
			 * 
			 * 
			 */
			data: {
				type: Array,
				default: []
			},
			/**
			 * 选择list item项
			 * 0、我的车源页面 出售中列表的item
			 * 1、我的车源页面 已下架列表的item
			 * 2、我的收藏 列表的item
			 */
			selecteItem: {
				type: String,
				default: '0'
			},
		},
		data() {
			return {

			};
		},

		methods: {
			tap_item(item) {
				this.$emit('change', item)
				this.$utils.log("点击了item项目" + JSON.stringify(item))
			},
			tap_item_del(item, index) {
				this.$emit('tap_item_del', item, index)
				this.$utils.log("点击了删除" + JSON.stringify(item) + '  index   ' + index)
			},
			tap_item_Up(item, index) {
				this.$emit('tap_item_Up', item, index)
				this.$utils.log("点击了上架" + JSON.stringify(item) + '  index   ' + index)
			},
			tap_item_edit(item, index) {
				this.$emit('tap_item_edit', item, index)
				this.$utils.log("点击了编辑" + JSON.stringify(item) + '  index   ' + index)
			},
			tap_item_down(item, index) {
				this.$emit('tap_item_down', item, index)
				this.$utils.log("点击了下架" + JSON.stringify(item) + '  index   ' + index)
			}
		}
	}
</script>

<style>
	.item-view-box-22 {
		width: auto;
		background: #EDF1FF;
		border-radius: 8rpx;

		text-align: center;
		font-size: 26rpx;
		font-family: Alibaba PuHuiTi;
		font-weight: 400;
		color: #0E59EA;
		opacity: 1;

		padding: 8rpx 30rpx;
		margin: 0rpx 4rpx;
	}

	.view-box-22 {
		display: flex;
		flex-flow: row wrap;
		height: auto;
		width: 100%;
		align-items: center;
		justify-content: flex-start
	}

	.marginTop20 {
		margin-top: 20rpx;
	}

	.item_box {
		margin-bottom: 14rpx;
		padding: 38rpx 22rpx 24rpx 28rpx;

		background: #FFFFFF;
		opacity: 1;
		border-radius: 14rpx;
	}

	.item-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		color: black;

		font-size: 32rpx;
		font-family: Alimama ShuHeiTi;
		font-weight: bold;
		color: #000026;
		opacity: 1;
	}

	.item-content-box {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.item-content {
		margin: 16rpx 24rpx 12rpx 0rpx;

		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
		opacity: 1;
	}

	.item-number-time-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin: 10rpx 0rpx;
	}

	.item-texr-price {
		flex: 1;
		text-align: left;

		font-size: 38rpx;
		font-family: DIN Alternate;
		font-weight: bold;
		color: #ED2F2F;
		opacity: 1;
	}

	.item-text-wan {
		margin-left: 12rpx;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
		opacity: 1;
	}

	.item-text-rulePrice {
		margin-left: 10rpx;

		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		opacity: 1;
	}

	.item-time {
		flex: 1;
		text-align: right;
		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		opacity: 1;
	}

	.item-sendTime {
		margin-top: 20rpx;

		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		opacity: 1;
	}

	.line-2 {
		height: 0rpx;
		border: 1px solid #00000006;

		width: 100%;
		margin-top: 20rpx;
	}

	.item-btn-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin-top: 20rpx;
	}

	.item-btn {
		flex: 1;
	}

	.item-btn-del {
		border: 2px solid #00000012;
		border-radius: 26rpx;

		text-align: right;
		color: black;
		padding: 6rpx 50rpx;

		font-size: 26rpx;
		font-family: Alibaba PuHuiTi;
		font-weight: 400;
		color: #333333;
		opacity: 1;
	}

	.item-btn-up {
		background: #0E59EA;
		opacity: 1;
		border-radius: 26rpx;
		padding: 6rpx 50rpx;
		margin-left: 10rpx;
		font-size: 26rpx;
		font-family: Alibaba PuHuiTi;
		font-weight: 400;
		color: #FFFFFF;
		opacity: 1;
	}
</style>